import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:loxen/utils/color.dart';

class LoadingWidget extends StatelessWidget {
  final String content;

  const LoadingWidget({Key key, this.content = '加载中···'}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Material(
        color: Colors.transparent,
        child: Center(
          child: SizedBox(
            width: 150.w,
            height: 150.w,
            child: Container(
              decoration: ShapeDecoration(
                color: Color(0x25000000),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(
                    Radius.circular(8.0),
                  ),
                ),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Padding(
                    padding: EdgeInsets.only(top: 10.w),
                    child: CircularProgressIndicator(
                      valueColor:AlwaysStoppedAnimation<Color>(Colours.app_main) ,
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.only(
                      top: 20.w,
                    ),
                    child: new Text(
                      content,
                      style: TextStyle(
                        fontSize: 24.sp,
                        color: Colors.white,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );

    return Container(
      child: Center(
        child: Image.asset('images/loading.gif'),
      ),
    );
  }
}
